package com.xy.biz.rs.domain.converter;

import java.util.Collection;
import java.util.List;

import com.xy.biz.rs.domain.req.*;
import com.xy.tool.util.BeanUtilsEx;
import com.xy.biz.rs.domain.bo.ManufactureApplyBO;
import com.xy.biz.rs.domain.po.ManufactureApplyPO;
import com.xy.biz.rs.domain.query.ManufactureApplyQuery;
import com.xy.biz.rs.domain.resp.GetManufactureApplyResponse;

/**
 *
 *
 * @author wwj
 * @date 2021-4-14
 */
public class ManufactureApplyConverter {

	public static ManufactureApplyPO toPO(ManufactureApplyBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new ManufactureApplyPO(), true);
	}

	public static List<ManufactureApplyPO> toPO(Collection<ManufactureApplyBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new ManufactureApplyPO(), true);
	}

	public static ManufactureApplyBO fromPO(ManufactureApplyPO source) {
		return BeanUtilsEx.copyProperties(source, () -> new ManufactureApplyBO());
	}

	public static List<ManufactureApplyBO> fromPO(Collection<ManufactureApplyPO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new ManufactureApplyBO());
	}

	public static ManufactureApplyBO toBO(SaveManufactureApplyRequest source) {
		return BeanUtilsEx.copyProperties(source, () -> new ManufactureApplyBO(), true);
	}

	public static ManufactureApplyBO toBO(UpdateManufactureApplyStatusRequest source) {
		return BeanUtilsEx.copyProperties(source, () -> new ManufactureApplyBO(), true);
	}

	public static ManufactureApplyBO toBO(UpdateManufactureApplyRequest source) {
		return BeanUtilsEx.copyProperties(source, () -> new ManufactureApplyBO(), true);
	}

	public static List<ManufactureApplyBO> toBO(Collection<SaveManufactureApplyRequest> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new ManufactureApplyBO(), true);
	}

	public static GetManufactureApplyResponse toResponse(ManufactureApplyBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new GetManufactureApplyResponse());
	}

	public static List<GetManufactureApplyResponse> toResponse(Collection<ManufactureApplyBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new GetManufactureApplyResponse());
	}

	public static ManufactureApplyQuery toQuery(ListManufactureApplyRequest source) {
		if(null == source) {
			return null;
		}
		ManufactureApplyQuery target = new ManufactureApplyQuery(source.getPageIndex(), source.getPageSize());
		BeanUtilsEx.copyProperties(source, target);
		return target;
	}

}
